#ifndef __TASK_SYNC_FILE_included
#define __TASK_SYNC_FILE_included

#include <string>
#include <vector>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include "../client-protocol/Task.h"
#include "../engine/Request.h"
#include "../engine/ServerDescriptor.h"
#include "../engine/DebugStream.h"
#include "../port/convert.h"
#include "../client-common/VersionTag.h"
#include "SyncFile.h"

using namespace std;
using namespace Client::Common;

namespace Client {
namespace File {

class CTaskSyncFile : public CTask {

	VersionTagRef mVersionTag;
	string mDevice;
	
	bool SyncFile(SyncFileRef sf, boost::shared_ptr<CConnection> c);
	bool GetFileList(int oldver, vector<SyncFileRef>& sfs, boost::shared_ptr<CConnection> c);
	int GetOldVersion();

public :

	CTaskSyncFile(string& dev, bool full_sync) : 
	   mDevice(dev), CTask(full_sync)
	{ }

	CTaskSyncFile(VersionTagRef vt, bool full_sync) : 
		mVersionTag(vt), mDevice(vt->mDevice), CTask(full_sync)
	{ }

	virtual bool Exec(boost::shared_ptr<CConnection> conn);
};

} // Client
} // File

#endif //__TASK_SYNC_FILE_included